AwtUtil

object AwtUtil

Miscellaneous functions to make AWT/Swing programming easier.

Properties

Link copied to clipboard
const val DEFAULT_INSET: Int = 0
Link copied to clipboard
const val DEFAULT_X_INSET: Int = 2
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
const val WINDOW_BOTTOM_LEFT: Int = 1
Link copied to clipboard
const val WINDOW_BOTTOM_RIGHT: Int = 0
Link copied to clipboard
const val WINDOW_CENTER: Int = 4
Link copied to clipboard
const val WINDOW_TOP_LEFT: Int = 2
Link copied to clipboard
const val WINDOW_TOP_RIGHT: Int = 3

Functions

Link copied to clipboard
Link copied to clipboard

Returns an instance of java.awt.Color for the given string, which should consist of a 6 digit hexadecimal string with a prefix of either '0x' or '#'. Returns null if the string specifies an invalid color.

Link copied to clipboard
fun drawHashOverArea(g: Graphics2D, x: Int, y: Int, width: Int, height: Int)

Draw diagonal hashing lines over the given area.

Link copied to clipboard
fun dumpSizingInformation(out: PrintStream, prefix: String?, c: Component?, depthLimit: Int)
Link copied to clipboard

Enable antialiasing on the given graphics object if it was an instance of Graphics2D. Returns the cast Graphics2D as a convenience.

Link copied to clipboard
fun getC(x: Int, y: Int, weightx: Float, weighty: Float, width: Int, height: Int, fillx: Boolean, filly: Boolean, align: Int, insets: Insets?): GridBagConstraints?
fun getC(x: Int, y: Int, weightx: Float, weighty: Float, width: Int, height: Int, padx: Int, pady: Int, topInset: Int, leftInset: Int, botInset: Int, rightInset: Int): GridBagConstraints?
Link copied to clipboard

Returns the nearest Frame or JDialog that is an ancestor to the given component. If no JDialog or Frame is found then return the top-most component ancestor.

Link copied to clipboard
fun getConstraints(x: Int, y: Int, weightx: Float, weighty: Float, width: Int, height: Int, fillx: Boolean, filly: Boolean): GridBagConstraints?
fun getConstraints(x: Int, y: Int, weightx: Float, weighty: Float, width: Int, height: Int, fillx: Boolean, filly: Boolean, align: Int): GridBagConstraints?
fun getConstraints(x: Int, y: Int, weightx: Float, weighty: Float, width: Int, height: Int, fillx: Boolean, filly: Boolean, align: Int, inset: Int): GridBagConstraints?
fun getConstraints(x: Int, y: Int, weightx: Float, weighty: Float, width: Int, height: Int, topInset: Int, leftInset: Int, botInset: Int, rightInset: Int): GridBagConstraints?
fun getConstraints(x: Int, y: Int, weightx: Float, weighty: Float, width: Int, height: Int, fillx: Boolean, filly: Boolean, align: Int, xinset: Int, yinset: Int): GridBagConstraints?
fun getConstraints(x: Int, y: Int, weightx: Float, weighty: Float, width: Int, height: Int, fillx: Boolean, filly: Boolean, topInset: Int, leftInset: Int, botInset: Int, rightInset: Int): GridBagConstraints?
fun getConstraints(x: Int, y: Int, weightx: Float, weighty: Float, width: Int, height: Int, fillx: Boolean, filly: Boolean, align: Int, topInset: Int, leftInset: Int, botInset: Int, rightInset: Int): GridBagConstraints?
Link copied to clipboard
fun getDialog(component: Component?): Dialog?
Link copied to clipboard
fun getFrame(component: Component?): Frame?
Link copied to clipboard
fun getJFrame(component: Component?): JFrame?

Since build 505 of Moneydance

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Return the hex string for the given colour. This does not include any 0x or # prefix and is only the 6 digit hexadecimal string.

Link copied to clipboard
Link copied to clipboard

Returns true if the given event should cause a context menu to be displayed for the item that was clicked. In general, if it was a secondary or right mouse button click, a control-click on mac, or possibly (but not currently) an alt-click on windows.

Link copied to clipboard

Returns true if the given event should select the target item, as well as all items between it and the previously selected item. In other words, was it a shift-click?

Link copied to clipboard

Returns true if the given event should add a single item to the selection (ie alt-click on windows/linux or command-click on mac)

Link copied to clipboard
fun loadImage(imageFileName: String): Image?
fun loadImage(base: Class<*>, imageFileName: String): Image?
fun loadImage(base: Class<*>, imageFileName: String, comp: Component?): Image?
Link copied to clipboard
fun setupWindow(child: Window, parent: Component?)
fun setupWindow(child: Window, position: Int)
fun setupWindow(child: Window, x: Int, y: Int)
fun setupWindow(child: Window, width: Int, height: Int, parent: Component?)
fun setupWindow(child: Window, width: Int, height: Int, position: Int)

fun setupWindow(child: Window, width: Int, height: Int, x: Int, y: Int, parent: Component? = null)

Set up the given window at the given size and location or centered on the given parent, if provided. This will ensure that the window is centered on the parent, the display with the given coordinates, or the default/main display if none of those apply. It will also ensure that the window is not shown off-screen and not too large to fit on the selected display.

Link copied to clipboard